package com.hh.core.common;


import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.plugins.Page;
import com.hh.core.entity.ResultEntity;

public class BaseController {

    protected static String REDIRECT = "redirect:";
    protected static String FORWARD = "forward:";
    
    protected ResultEntity successResult(Object data){
    	ResultEntity re = new ResultEntity(true,"操作成功!",data);
    	return re;
    }
    
    protected ResultEntity errorResult(Object data){
    	ResultEntity re = new ResultEntity(false,"操作失败!",data);
    	return re;
    }
    
    @SuppressWarnings("rawtypes")
	protected JSONObject pageJosn(Page page){
    	JSONObject json = new JSONObject();
    	json.put("total", page.getTotal());
    	json.put("rows", page.getRecords());
    	return json;
    } 
}
